package com.tencent.smtt.sdk;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;

/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes2.dex */
public class o {
    static boolean a = false;
    private static o d = null;
    private static int g = 0;
    private static int h = 0;
    private static int i = 3;
    private static String k;
    private bh b = null;
    private bh c = null;
    private boolean e = false;
    private boolean f = false;
    private File j = null;

    private o() {
    }

    public static o a(boolean z) {
        if (d == null && z) {
            synchronized (o.class) {
                if (d == null) {
                    d = new o();
                }
            }
        }
        return d;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public static void a(int i2) {
        g = i2;
    }

    private void b(int i2) {
        String valueOf = String.valueOf(i2);
        Properties properties = new Properties();
        properties.setProperty(k, valueOf);
        try {
            properties.store(new FileOutputStream(new File(this.j, "count.prop")), (String) null);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e2) {
            e2.printStackTrace();
        }
    }

    public static int e() {
        return g;
    }

    /* JADX WARN: Not initialized variable reg: 2, insn: 0x0054: MOVE  (r1 I:??[OBJECT, ARRAY]) = (r2 I:??[OBJECT, ARRAY]), block:B:27:0x0054 */
    /* JADX WARN: Removed duplicated region for block: B:41:0x0057 A[EXC_TOP_SPLITTER, SYNTHETIC] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    private int j() {
        /*
            r6 = this;
            r0 = 0
            r1 = 0
            java.io.File r2 = new java.io.File     // Catch: java.lang.Throwable -> L3f java.lang.Exception -> L41
            java.io.File r3 = r6.j     // Catch: java.lang.Throwable -> L3f java.lang.Exception -> L41
            java.lang.String r4 = "count.prop"
            r2.<init>(r3, r4)     // Catch: java.lang.Throwable -> L3f java.lang.Exception -> L41
            boolean r3 = r2.exists()     // Catch: java.lang.Throwable -> L3f java.lang.Exception -> L41
            if (r3 != 0) goto L12
            return r0
        L12:
            java.io.FileInputStream r3 = new java.io.FileInputStream     // Catch: java.lang.Throwable -> L3f java.lang.Exception -> L41
            r3.<init>(r2)     // Catch: java.lang.Throwable -> L3f java.lang.Exception -> L41
            java.io.BufferedInputStream r2 = new java.io.BufferedInputStream     // Catch: java.lang.Throwable -> L3f java.lang.Exception -> L41
            r2.<init>(r3)     // Catch: java.lang.Throwable -> L3f java.lang.Exception -> L41
            java.util.Properties r1 = new java.util.Properties     // Catch: java.lang.Exception -> L3d java.lang.Throwable -> L53
            r1.<init>()     // Catch: java.lang.Exception -> L3d java.lang.Throwable -> L53
            r1.load(r2)     // Catch: java.lang.Exception -> L3d java.lang.Throwable -> L53
            java.lang.String r3 = com.tencent.smtt.sdk.o.k     // Catch: java.lang.Exception -> L3d java.lang.Throwable -> L53
            java.lang.String r4 = "1"
            java.lang.String r1 = r1.getProperty(r3, r4)     // Catch: java.lang.Exception -> L3d java.lang.Throwable -> L53
            java.lang.Integer r1 = java.lang.Integer.valueOf(r1)     // Catch: java.lang.Exception -> L3d java.lang.Throwable -> L53
            int r0 = r1.intValue()     // Catch: java.lang.Exception -> L3d java.lang.Throwable -> L53
            r2.close()     // Catch: java.io.IOException -> L38
            goto L3c
        L38:
            r1 = move-exception
            r1.printStackTrace()
        L3c:
            return r0
        L3d:
            r1 = move-exception
            goto L45
        L3f:
            r0 = move-exception
            goto L55
        L41:
            r2 = move-exception
            r5 = r2
            r2 = r1
            r1 = r5
        L45:
            r1.printStackTrace()     // Catch: java.lang.Throwable -> L53
            if (r2 == 0) goto L52
            r2.close()     // Catch: java.io.IOException -> L4e
            goto L52
        L4e:
            r1 = move-exception
            r1.printStackTrace()
        L52:
            return r0
        L53:
            r0 = move-exception
            r1 = r2
        L55:
            if (r1 == 0) goto L5f
            r1.close()     // Catch: java.io.IOException -> L5b
            goto L5f
        L5b:
            r1 = move-exception
            r1.printStackTrace()
        L5f:
            throw r0
        */
        throw new UnsupportedOperationException("Method not decompiled: com.tencent.smtt.sdk.o.j():int");
    }

    public void a() {
        this.c = null;
    }

    /* JADX WARN: Removed duplicated region for block: B:13:0x0015 A[Catch: all -> 0x0067, TryCatch #0 {, blocks: (B:3:0x0001, B:5:0x0005, B:13:0x0015, B:15:0x001c, B:17:0x003b, B:20:0x0044, B:21:0x0050, B:24:0x0062), top: B:30:0x0001, inners: #1 }] */
    /* JADX WARN: Removed duplicated region for block: B:14:0x001b  */
    /* JADX WARN: Removed duplicated region for block: B:17:0x003b A[Catch: all -> 0x0067, TRY_LEAVE, TryCatch #0 {, blocks: (B:3:0x0001, B:5:0x0005, B:13:0x0015, B:15:0x001c, B:17:0x003b, B:20:0x0044, B:21:0x0050, B:24:0x0062), top: B:30:0x0001, inners: #1 }] */
    /* JADX WARN: Removed duplicated region for block: B:20:0x0044 A[Catch: all -> 0x0067, TRY_ENTER, TRY_LEAVE, TryCatch #0 {, blocks: (B:3:0x0001, B:5:0x0005, B:13:0x0015, B:15:0x001c, B:17:0x003b, B:20:0x0044, B:21:0x0050, B:24:0x0062), top: B:30:0x0001, inners: #1 }] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    public synchronized void a(android.content.Context r9, boolean r10, boolean r11) {
        /*
            r8 = this;
            monitor-enter(r8)
            com.tencent.smtt.sdk.bh r10 = r8.c     // Catch: java.lang.Throwable -> L67
            if (r10 != 0) goto L65
            int r10 = com.tencent.smtt.sdk.o.g     // Catch: java.lang.Throwable -> L67
            r11 = 25436(0x635c, float:3.5643E-41)
            if (r10 == r11) goto L12
            r11 = 25437(0x635d, float:3.5645E-41)
            if (r10 != r11) goto L10
            goto L12
        L10:
            r10 = 0
            goto L13
        L12:
            r10 = 1
        L13:
            if (r10 == 0) goto L1b
            android.content.Context r10 = r9.getApplicationContext()     // Catch: java.lang.Throwable -> L67
            r2 = r10
            goto L1c
        L1b:
            r2 = r9
        L1c:
            com.tencent.smtt.sdk.am r10 = com.tencent.smtt.sdk.am.a()     // Catch: java.lang.Throwable -> L67
            java.io.File r10 = r10.r(r9)     // Catch: java.lang.Throwable -> L67
            java.io.File r11 = new java.io.File     // Catch: java.lang.Throwable -> L67
            java.lang.String r0 = "tbs_sdk_extension_dex.jar"
            r11.<init>(r10, r0)     // Catch: java.lang.Throwable -> L67
            com.tencent.smtt.sdk.QbSdk.initForinitAndNotLoadSo(r9)     // Catch: java.lang.Throwable -> L67
            java.lang.String r11 = r11.getParent()     // Catch: java.lang.Throwable -> L67
            com.tencent.smtt.sdk.QbSdk.loadTBSSDKExtension(r9, r11)     // Catch: java.lang.Throwable -> L67
            boolean r11 = com.tencent.smtt.sdk.QbSdk.getJarFilesAndLibraryPath(r9)     // Catch: java.lang.Throwable -> L67
            if (r11 != 0) goto L44
            java.lang.String r9 = "SDKEngine"
            java.lang.String r10 = "initAndNotLoadSo error getJarFilesAndLibraryPath return false"
            com.tencent.smtt.utils.TbsLog.i(r9, r10)     // Catch: java.lang.Throwable -> L67
            monitor-exit(r8)
            return
        L44:
            java.lang.String r4 = r10.getAbsolutePath()     // Catch: java.lang.Throwable -> L67
            java.lang.String r11 = r10.getAbsolutePath()     // Catch: java.lang.Throwable -> L67
            java.lang.String[] r5 = com.tencent.smtt.sdk.QbSdk.getDexLoaderFileList(r9, r2, r11)     // Catch: java.lang.Throwable -> L67
            com.tencent.smtt.sdk.bh r11 = new com.tencent.smtt.sdk.bh     // Catch: java.lang.Exception -> L61 java.lang.Throwable -> L67
            java.lang.String r3 = r10.getAbsolutePath()     // Catch: java.lang.Exception -> L61 java.lang.Throwable -> L67
            java.lang.String r6 = com.tencent.smtt.sdk.QbSdk.d     // Catch: java.lang.Exception -> L61 java.lang.Throwable -> L67
            r7 = 0
            r0 = r11
            r1 = r9
            r0.<init>(r1, r2, r3, r4, r5, r6, r7)     // Catch: java.lang.Exception -> L61 java.lang.Throwable -> L67
            r8.c = r11     // Catch: java.lang.Exception -> L61 java.lang.Throwable -> L67
            goto L65
        L61:
            r9 = move-exception
            r9.printStackTrace()     // Catch: java.lang.Throwable -> L67
        L65:
            monitor-exit(r8)
            return
        L67:
            r9 = move-exception
            monitor-exit(r8)
            throw r9
        */
        throw new UnsupportedOperationException("Method not decompiled: com.tencent.smtt.sdk.o.a(android.content.Context, boolean, boolean):void");
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public void a(String str) {
        k = str;
    }

    public bh b() {
        if (this.e) {
            return this.b;
        }
        return null;
    }

    /* JADX WARN: Removed duplicated region for block: B:44:0x00fb A[Catch: all -> 0x0168, TryCatch #2 {, blocks: (B:4:0x0004, B:8:0x0043, B:17:0x0065, B:19:0x009a, B:74:0x01e7, B:68:0x019f, B:70:0x01d2, B:73:0x01d7, B:23:0x00a0, B:25:0x00a6, B:27:0x00b3, B:29:0x00ca, B:52:0x010f, B:53:0x0118, B:55:0x011b, B:56:0x011e, B:58:0x0124, B:60:0x012d, B:62:0x0148, B:64:0x0164, B:63:0x0155, B:59:0x0129, B:32:0x00d3, B:36:0x00de, B:44:0x00fb, B:47:0x0104), top: B:82:0x0004 }] */
    /* JADX WARN: Removed duplicated region for block: B:45:0x0101  */
    /* JADX WARN: Removed duplicated region for block: B:47:0x0104 A[Catch: all -> 0x0168, TRY_LEAVE, TryCatch #2 {, blocks: (B:4:0x0004, B:8:0x0043, B:17:0x0065, B:19:0x009a, B:74:0x01e7, B:68:0x019f, B:70:0x01d2, B:73:0x01d7, B:23:0x00a0, B:25:0x00a6, B:27:0x00b3, B:29:0x00ca, B:52:0x010f, B:53:0x0118, B:55:0x011b, B:56:0x011e, B:58:0x0124, B:60:0x012d, B:62:0x0148, B:64:0x0164, B:63:0x0155, B:59:0x0129, B:32:0x00d3, B:36:0x00de, B:44:0x00fb, B:47:0x0104), top: B:82:0x0004 }] */
    /* JADX WARN: Removed duplicated region for block: B:50:0x010d  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    public synchronized void b(android.content.Context r11, boolean r12, boolean r13) {
        /*
            Method dump skipped, instructions count: 502
            To view this dump change 'Code comments level' option to 'DEBUG'
        */
        throw new UnsupportedOperationException("Method not decompiled: com.tencent.smtt.sdk.o.b(android.content.Context, boolean, boolean):void");
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public boolean b(boolean z) {
        a = z;
        return z;
    }

    public boolean c() {
        return this.e;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public bh d() {
        return this.b;
    }

    public String f() {
        return (this.b == null || QbSdk.a) ? "system webview get nothing..." : this.b.a();
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public boolean g() {
        if (a) {
            if (k == null) {
                return false;
            }
            int j = j();
            if (j == 0) {
                b(1);
            } else {
                int i2 = j + 1;
                if (i2 > i) {
                    return false;
                }
                b(i2);
            }
        }
        return a;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public boolean h() {
        return this.f;
    }

    public boolean i() {
        return QbSdk.useSoftWare();
    }
}
